<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />

<link href="<%=path %>/css/layout.css" type="text/css" rel="stylesheet" />
<script type='text/javascript'
	src='<%=path %>/dwr/interface/cartService.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script language="JavaScript" src="<%=path %>/js/public.js"
	type="text/javascript"></script>
<script type="text/javascript">
	        function modiNum(goodsId,quantity)
	        {
	            var r1= /^[0-9]*[1-9][0-9]*$/ //正整数 
	            var val=r1.test(quantity); //str为你要判断的字符 执行返回结果 true 或 false
	            if(val==false)
	            {
	                alert("数量必须是数字,请重新输入");
	            }
	            else
	            {
	                document.getElementById("indicator1").style.display="block";
	                cartService.modiNum(goodsId,quantity,callback);
	            }
	        }
	        
	        function callback(data)
	        {
	            document.getElementById("indicator1").style.display="none";
	            if(data=="no")
			    {
			        alert("库存不足");
			    }
			    
	            document.location.reload(true);
	        }
	        
	        
	        function delGoodsFromCart(goodsId)
	        {
	            document.getElementById("indicator1").style.display="block";
	            cartService.delGoodsFromCart(goodsId,callback);
	        }
	        
	        function clearCart()
	        {
	            document.getElementById("indicator1").style.display="block";
	            cartService.clearCart(callback);
	        }
    </script>
</head>

<body>
	<div class="container">
		<jsp:include flush="true" page="/qiantai/inc/incTop.jsp"></jsp:include>

		<div class="row">
			<!--左边的 -->
			<div class="content col-sm-3">
				

				<div class="panel panel-primary">
					<div class="panel-heading">
						<h3 class="panel-title">手机品牌</h3>
					</div>
					<div class="panel-body">
					</div>
				</div>
				
			</div>
			<!--左边的 -->
			<div class="content col-sm-6">
							
					<div class="panel panel-primary" style="height: 406px;">
					<div class="panel-heading">
						<h3 class="panel-title">我的购物车</h3>
					</div>
					<div class="panel-body">
						<table class="table table-hover"  width="99%" border="0" cellpadding="2" cellspacing="1"
								bgcolor="#FFFFFF" align="center" style="margin-top: 8px">
								<tr align="center" bgcolor="#FAFAF1" height="22">
									<td>手机名称</td>
									<td>价格</td>
									<td>数量</td>
									<td>金额</td>
									<td>删除</td>
								</tr>
									<tr align='center' bgcolor="#FFFFFF" height="22">
										<td>1111</td>
											<td>1111</td>
										<td><input type="text" class="textBox"
											onChange="modiNum()"
											value="" size="4" /></td>
										<td>￥</td>
										<td><input
											onClick="delGoodsFromCart()"
											type="image" src="<%=path %>/img/delete_01.gif" border="0" /></td>
									</tr>
								<tr>
									<td colspan="6" class="Order_Total"><img hspace="5"
										src="<%=path %>/img/me03.gif" /> 总金额：￥<span id="totalMoney"></span> &nbsp;&nbsp;&nbsp;&nbsp;
										<img id="indicator1" src="<%=path %>/img/loading.gif"
										style="display: none" /></td>
								</tr>
							</table>
					</div>
				
								
							<table>
								<tr height="7">
									<td></td>
								</tr>
								<tr>
									<td width="100"></td>
									<td><a href="#" onclick="clearCart()"><img border="0"
											src="<%=path %>/img/Car_icon_01.gif" /></a></td>
									<td><a href="<%=path %>/qiantai/default.jsp"><img
											border="0" src="<%=path %>/img/Car_icon_02.gif" /></a></td>
									<td><a href="<%=path %>/orderQueren.action"><img
											border="0" src="<%=path %>/img/Car_icon_03.gif" /></a></td>
								</tr>
							</table>
						</div>
			</div>
		<div class="content col-sm-3">
				<div class="panel panel-primary">
					<div class="panel-heading">
						<h3 class="panel-title">用户登录</h3>
					</div>
					<div class="panel-body">
						<jsp:include flush="true" page="/qiantai/userlogin/userlogin.jsp"></jsp:include>
					</div>
				</div>
				<div class="panel panel-primary">
					<div class="panel-heading">
						<h3 class="panel-title">网站公告</h3>
					</div>
					<div class="panel-body">
					</div>
				</div>
			</div>
		<div style="clear: both"></div>
			<!-- 右边的用户登录。留言。投票 -->
		</div>
		<div class="foot">
			<jsp:include flush="true" page="/qiantai/inc/incFoot.jsp"></jsp:include>
		</div>
	</div>
</body>
</html>
